Script Preparation code:
x
 
var N = 10000
var x1 = new Float32Array(N);
var x2 = new Float32Array(N);
var x3 = new Float32Array(N);
var AoS1 = [];
var AoS2 = [];
var AoS3 = [];
for (var i = 0; i < N; ++i) {
    x1[i] = Math.random();
    x2[i] = Math.random();
    x3[i] = Math.random();
    AoS1.push( {x:Math.random(), y:Math.random(), z:Math.random()} );
    AoS2.push( {x:Math.random(), y:Math.random(), z:Math.random()} );
    AoS3.push( {x:Math.random(), y:Math.random(), z:Math.random()} );
}
Tests:
  • SoA

     
    for (var i = 0; i < N; ++i) {
        x3[i] = x1[i] + x2[i];
    }
  • AoS

     
    for (var i = 0; i < N; ++i) {
        AoS3[i].x = AoS1[i].x + AoS2[i].x;
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    SoA
    AoS

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (iPad; CPU OS 15_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6,2 Mobile/15E148 Safari/604.1
Mobile Safari 15 on iOS 15.7
View result in a separate tab
Test name Executions per second
SoA 635.7 Ops/sec
AoS 620.5 Ops/sec